public class test2 {
    public static void main(String[] args) {
    System.out.println("1~100之间的素数有:");
    int count = 0;

    for(int i = 1; i < 101; ++i) {
        boolean flag = true;

        for(int j = 2; j < i; ++j) {
            if (i % j == 0) {
                flag = false;
                break;
            }
        }

        if (flag) {
            System.out.print("" + i + " ");
            ++count;
        }
    }

    System.out.println("\n一共有" + count + "个素数");
}
}
